﻿package com.wly.utils
{
	public class MyPoint
	{
		public var x:int;
		public var y:int;
		
		public function MyPoint(valX:int=0, valY:int=0)
		{
			x = valX;
			y = valY;
		}
		
		public function equals(point:MyPoint):Boolean
		{
			if(!point)
			{
				return false;
			}
			
			if(point.x==this.x && point.y==this.y)
			{
				return true;
			}
			
			return false;
		}
		
		static public function distance(pt1:MyPoint, pt2:MyPoint):Number
		{
			var dis:Number;
			if(!pt1 || !pt2)
			{
				return 0;
			}
			var disX:int;
			var disY:int;
			disX = Math.abs(pt1.x-pt2.x);
			disY = Math.abs(pt1.y-pt2.y);
			return Math.sqrt(disX*disX+disY*disY);
		}
	}
}